#include "StdAfx.h"
#include "FindNumber.h"


FindNumber::FindNumber(int number)
{
	//{{1,2,8,9},{2,4,9,12},{4,7,10,13},{6,8,11,15}}
	find(number);
}


FindNumber::~FindNumber(void)
{
}

void FindNumber::find(int number ){
	int matrix[4][4] = {{1,2,8,9},{2,4,9,12},{4,7,10,13},{6,8,11,15}};

	//int nowRow = 3;
	//int nowNum = 3;

	for(int nowRow = 0,nowNum=3;nowRow<3 && nowNum>0;){

		if(number>matrix[nowRow][nowNum]){
			nowRow++;
		}else if(number<matrix[nowRow][nowNum]){
			nowNum--;
		}else if(number == matrix[nowRow][nowNum]){
			cout<<"find nowRow="<<nowRow<<";and nowNum="<<nowNum<<endl;
			break;
		}

	}

	
}